from sqlalchemy import Column, String, Integer, Boolean, Date, DateTime, func
from sqlalchemy.sql.expression import true
from database import Base


# 定义数据模型
class User(Base):
    __tablename__ = "user"
    userID = Column(Integer, primary_key=True, index=True, autoincrement=True, comment="用户ID")
    username = Column(String(100), nullable=False, comment="用户名称")
    userEmail = Column(String(100), nullable=False, comment="用户邮箱")
    password = Column(String(100), nullable=False, comment="用户密码")
    state = Column(Boolean, nullable=True, comment="用户状态")
    depeID = Column(Integer, nullable=True, comment="部门ID")
    roleID = Column(Integer, nullable=True, comment="角色ID")
    token = Column(String(100), nullable=True, comment="token")

    created_at = Column(DateTime, server_default=func.now(), comment="创建时间")
    updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间")
    